package edu.sctu.alex.June.day20150615.serialization;

import java.io.*;

/**
 * Created by alex on 2015/6/15.
 */
public class SimpleSerial {

    public static void main(String[] args) throws Exception{
        File file = new File("F://person.out");
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file));

        Person person = new Person("Alex",18,Gender.MALE);
        objectOutputStream.writeObject(person);
        objectOutputStream.close();

        ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(file));

        Object newPweson = objectInputStream.readObject();
        objectInputStream.close();
        System.out.println(newPweson);
    }
}
